package cn.yiueil.service.impl;

import cn.yiueil.entity.Pokemon;
import cn.yiueil.entity.PokemonEntity;
import cn.yiueil.mapper.PokemonMapper;
import cn.yiueil.service.PokemonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public class PokemonServiceImpl implements PokemonService {
    @Autowired
    private PokemonMapper pokemonMapper;

    @Override
//    @Transactional
    public void show() {
        List<PokemonEntity> pokemonList = pokemonMapper.getPokemonList();
        System.out.println(pokemonList);
    }

    @Override
//    @Transactional
    public void add() {
        PokemonEntity pokemon = new PokemonEntity();
        pokemon.setId(9992);
        pokemonMapper.save(pokemon);
    }

    @Override
    public List<PokemonEntity> selectPokemonList() {
        return pokemonMapper.getPokemonList();
    }

    @Override
    public void modifyPokemon(PokemonEntity pokemonEntity) {
        pokemonMapper.update(pokemonEntity);
    }
}
